package com.swallowtech.mstation.core;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.swallowtech.mstation.core.domain.MusicBookmark;
import com.swallowtech.mstation.core.domain.Tag;
import com.swallowtech.mstation.core.service.BookmarkService;

/**
 * Hello world!
 * 
 */
public class App {
	public static void main(String[] args) {
		System.out.println("Hello World!");

		ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
		
//		MusicGenreRepository repository = context.getBean(MusicGenreRepository.class);
//		SampleService service = context.getBean(SampleService.class);
//		
//		MusicGenre genre = service.getMusicGenreByID(1);
//		
//		System.out.println(genre.getGenreName());
		
		BookmarkService service = context.getBean(BookmarkService.class);
		
		MusicBookmark bookmark = new MusicBookmark();
		
		bookmark.setId("ID0001");
		bookmark.setUserId("U00001");
		bookmark.setName("Love is stronger than pride");
		bookmark.setUrl("www.youtube.com/watch?v=AAjtlI6YjOw");
		bookmark.setResourceKey("AAjtlI6YjOw");
		bookmark.setDescription("best of sala");
		
		bookmark.setType(1);		
		bookmark.setGenreId(1);
		
		Tag tag = new Tag();
		tag.setId("0001");
		tag.setName("Mellow");
		tag.setUserId("U00001");
		tag.setSortOrder(1);
		
		Collection<Tag> tags = new ArrayList<Tag>();
		tags.add(tag);
		
		bookmark.setTags(tags);
		
		HashMap<String ,Tag> userAllTags = new HashMap<String ,Tag>();
		
		service.saveBookmark(bookmark,userAllTags);
		
		
	}
}
